﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;

namespace AttributeLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            MyClass.Message("this is myclass");
            Console.ReadLine();
        }
    }
    /// <summary>
    /// Conditional特性，它的参数为预处理标志符，DEBUG,RELEASE,TRACE，当设置为RELEASE，在工程为DEBUG的时候
    /// 一切与该函数有关的调用将不会编译，也就是说，Conditional引起了条件编译
    /// 注意：Trace设置在项目的属性-->生成-->生成Trace中设置
    /// </summary>
    class MyClass
    {
        [Conditional("RELEASE")]
        public static void Message(string msg)
        {
            Console.WriteLine(msg);
        }
    }

    [AttributeUsage(AttributeTargets.Class)]
    public class HelpAttribute : Attribute
    {
        public HelpAttribute(String Description_in)
        {
            this.description = Description_in;
        }
        protected String description;
        public String Description
        {
            get
            {
                return this.description;
            }
        }
    }

    [Help("this is a do-nothing class")]
    public class AnyClass
    {
        //[Help("this is do-nothing method")]---->因为Help指定只作用于类，
        public void AnyMethod()
        { }
    }


}
